package com.goodluck.goodluckim.sdk.session;

import android.text.TextUtils;

import com.goodluck.goodluckim.sdk.constant.MsgType;
import com.goodluck.goodluckim.sdk.constant.SessionType;
import com.goodluck.goodluckim.db.model.RecentSession;

/**
 * Created by wyj on 2018/9/12.
 */

public class DefaultRecentCustonization implements RecentCustomization {

    @Override
    public String getDefaultTitle(RecentSession recentSession) {
        if (TextUtils.isEmpty(recentSession.getObjectName())) {
            switch (recentSession.getSessionType()) {
                case SessionType.P2P:
                    return "个聊";
                case SessionType.TEAM:
                    return "群聊";
                case SessionType.TEAM_NOTICE:
                    return "群通知";
                default:
                    return "自定义消息";
            }
        }
        return "自定义消息";
    }

    /**
     * 最近联系人列表项文案定制
     *
     * @param recentSession 最近联系人
     * @return 默认文案
     */
    @Override
    public String getDefaultDigest(RecentSession recentSession) {
        switch (recentSession.getMessageType()) {
            case MsgType.TEXT:
                return recentSession.getMessageContent();
            case MsgType.IMAGE:
                return "[图片]";
            case MsgType.VIDEO:
                return "[视频]";
            case MsgType.Audio:
                return "[语音消息]";
            case MsgType.LOCATION:
                return "[位置]";
            case MsgType.FILE:
                return "[文件]";
            default:
                return "[自定义消息] ";
        }
    }
}
